home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj8505.arc
/
VOLT.BAS
< prev
Wrap
BASIC Source File
|
1986-09-14
|
1KB
|
37 lines
10 ' PC VOLTMETER -- Copyright 1984 Michael A. Covington
20 ' Uses the PC Game Control Adapter to measure voltage.
30 ' Can be used with any of the voltmeter circuits in
40 ' the accompanying article provided the calibration
50 ' voltages used are within the range of the circuit.
70 CLS : KEY OFF
80 PRINT "PC VOLTMETER"
90 PRINT
100 PRINT "Connect first calibration voltage, ";
105 PRINT "then press any key."
110 IF INKEY$="" THEN 110
120 READING1 = 1/STICK(0)
140 PRINT "Reading taken."
141 PRINT
142 INPUT "Value of that voltage (in volts)";VOLTAGE1
150 PRINT
160 PRINT "Connect second calibration voltage, ";
165 PRINT "then press any key."
170 IF INKEY$="" THEN 170
180 READING2 = 1/STICK(0)
185 PRINT "Reading taken."
186 PRINT
190 INPUT "Value of that voltage (in volts)";VOLTAGE2
200 FACTOR = (READING2-READING1)/(VOLTAGE2-VOLTAGE1)
210 OFFSET = READING2 - (VOLTAGE2*FACTOR)
260 PRINT:PRINT "Calibrated"
280 PRINT
290 PRINT "PC VOLTMETER at your service..."
300 PRINT:PRINT "Press any key to take a reading"
320 IF INKEY$="" THEN 320
330 READING = 1/STICK(0)
340 VOLTAGE = (READING-OFFSET)/FACTOR
350 COLOR 15,0
360 PRINT USING "##.### volts";VOLTAGE
370 COLOR 7,0
380 GOTO 280